package com.itheima.controller;

import com.itheima.domain.Book;
import com.itheima.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/books")
public class BookServlet {
    @Autowired
    private BookService bookService;

    @GetMapping
    public List<Book> selectAll(){
        System.out.println(123);
        List<Book> books = bookService.selectAll();
        return books;
    }
}
